package org.xiangsai.core;

import grpc.HelloGrpc;
import grpc.HelloMessage;

/**
 * 方法实现
 */
public class HelloImpl extends HelloGrpc.HelloImplBase {
    @Override
    public void sayHello(HelloMessage.HelloRequest request, io.grpc.stub.StreamObserver<HelloMessage.HelloResponse> responseObserver) {
        System.out.println("客户处调用");
        String message=request.getName()+"，我是通过服务端处理过的内容";
        HelloMessage.HelloResponse build = HelloMessage.HelloResponse.newBuilder().setMessage(message).build();
        //调用onNext()方法来通知gRPC框架把reply 从server端 发送回 client端
        responseObserver.onNext(build);
        //调用完成
        responseObserver.onCompleted();
    }
}
